<!DOCTYPE html>
<head>
    <script>
        function find(arr,num){
            for(let i=0;i<arr.length;i++){
                if(arr[i]==num)
                    return i;
            }
            return -1;
        }
        alert(find([1,2,3,4],3))
    </script>
</head>